#ifndef MAINLOGINWIDGET_H
#define MAINLOGINWIDGET_H

#include <QStackedWidget>
#include <QWidget>
#include "Functionality/functionalityFactory.h"
#include "logincode.h"
#include "phoneloginwidget.h"
#include <Functionality/functionalityInterface.h>

class mainLoginWidget : public QWidget
{
    Q_OBJECT
public:
    explicit mainLoginWidget(QWidget *parent = nullptr);

protected:
    void mousePressEvent(QMouseEvent *event) override;
    void mouseMoveEvent(QMouseEvent *event) override;
    void mouseReleaseEvent(QMouseEvent *event) override;
    void paintEvent(QPaintEvent *event) override;
signals:

private:
    void addButtonIconMapping(QAbstractButton *button,
                              const QString &iconEnter,
                              const QString &iconLevel);
    bool eventFilter(QObject *watch, QEvent *event) override;

    void checkAndInitializeCertificates();

private:
    QVBoxLayout *mainVLayout;
    QPushButton *btnMin;
    QPushButton *btnClose;
    QLabel *label;
    QHBoxLayout *titleBarHLayout;
    QStackedWidget *widgetStack;
    loginCode *loginCodeWidget;
    bool m_dragging;
    QPoint m_offset;
    QMap<QAbstractButton *, QPair<QString, QString>> buttonIconMap; //这是图标变化的map

    phoneLoginWidget *phonelogin;
    std::shared_ptr<FunctionalityFactory> factory;
    std::shared_ptr<FunctionalityInterface> Functionality;
};

#endif // MAINLOGINWIDGET_H
